<template>
  <a-range-picker
    :allowClear="false"
    separator="→"
    :showTime="showTime"
    :format="format"
    :default-value="defaultValue"
    :value="times"
    :placeholder="['选择开始时间', '选择结束时间']"
    @change="onChange"
    @ok="onOk"
    class="cccaaadd"
  />
</template>
<script>
export default {
  name: 'startEndTimeInit',
  props: {
    times: {
      type: Array,
      default: [],
    },
    defaultValue: [Array],
    format: {
      type: String,
      default: 'YYYY-MM-DD HH:mm',
    },
    showTime: [Object, Boolean],
  },
  methods: {
    onChange(value, dateString) {
      this.$emit('timeChange', value, dateString)
    },
    onOk(value) {
      this.$emit('timeOk', value)
    },
  },
}
</script>